﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;

namespace DavidService
{
    public partial class Service : ServiceBase
    {
        System.Timers.Timer timer = null;
        string threadId = "Heart";
        DavidLog.LogManager log;
        
        public Service()
        {
            InitializeComponent();
        }

        protected override void OnStart(string[] args)
        {
            log = new DavidLog.LogManager(threadId);
            log.Info("服务被启动......");
            timer = new System.Timers.Timer();
            timer.Elapsed += timer_Elapsed;
            timer.Interval = 1000;
            timer.Start();
        }

        protected override void OnStop()
        {
            log.Info("服务被停止......");
        }

        void timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
        {
            log.Info("服务运行中......");
        }
    }
}
